import {Component} from '@angular/core';
import {Platform} from 'ionic-angular';
import {StatusBar} from '@ionic-native/status-bar';
import {SplashScreen} from '@ionic-native/splash-screen';

import {TabsPage} from '../pages/tabs/tabs';

@Component({
  templateUrl: 'app.html'
})
export class MyApp {
  rootPage: any = TabsPage;

  constructor(public platform: Platform, public statusBar: StatusBar, public splashScreen: SplashScreen) {
    if (this.platform.is('android')) {
      //不要放在ready下执行  导致布局 取值不及时
      document.body.classList.add('g-body-md')
    }
    this.platform.ready().then(() => {
      if (this.platform.is('android')) {
        this.statusBar.hide()
        // this.statusBar.show()
        // this.statusBar.overlaysWebView(true)
        // setTimeout(()=>{
        //   this.statusBar.backgroundColorByHexString('#55000000')
        //   this.statusBar.styleLightContent()
        // },1500)
        //模拟透明
        // this.statusBar.backgroundColorByHexString('#c1180a')
        // this.statusBar.styleLightContent()
        // this.statusBar.backgroundColorByHexString('#fff')
        // this.statusBar.styleDefault()
      } else {
        this.statusBar.styleDefault()
      }
      this.splashScreen.hide()
    });
  }

  ngAfterViewInit() {
    this.statusBar.styleLightContent()
  }
}
